home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 26 (Anniversary Edition)
/
Volume 26 [Anniversary Edition] - JOGO DISK .iso
/
DEPOSITO
/
sb_bust.swf
/
scripts
/
__Packages
/
PlayerObj.as
< prev
Wrap
Text File
|
2006-07-26
|
12KB
|
462 lines
class PlayerObj extends CharacterObj
{
function PlayerObj(l_RefMov)
{
super(l_RefMov);
if(_global.Param.G_StartKO)
{
this.State = "WaitKO";
this.StateOld = "WaitKO";
l_RefMov.gotoAndStop(this.State);
}
this.RPress = false;
this.RRelease = true;
this.LPress = false;
this.LRelease = true;
this.SPress = false;
this.SRelease = true;
this.DPress = false;
this.DRelease = true;
this.DwPress = false;
this.SpPress = false;
this.SpRelease = true;
this.DoAttack = false;
this.ActionNow = "";
this.PunchRDammage = 5;
this.PunchLDammage = 5;
this.KickRDammage = 15;
this.KickLDammage = 15;
this.PunchRPts = 150;
this.PunchLPts = 150;
this.ParryPunchPts = 250;
this.KickRPts = 500;
this.KickLPts = 500;
this.PtSA = _global.Param.G_PtSA;
this.NbPtSAWin = 5;
this.HaveParry = false;
this.ParryTimeMax = 105;
this.ParryTime = 0;
this.AvoidAttack = "";
}
function Wait()
{
}
function WaitKO()
{
}
function Return()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
_global.Param.G_StartKO = false;
_global.C.Enemy.ReturnIdle();
this.RefMov._parent.EndLock.gotoAndStop(1);
this.ReturnIdle();
}
}
function Idle()
{
if(this.WillWin)
{
this.RefMov._parent.EndLock.gotoAndStop(2);
this.State = "Win";
}
}
function StartParryR()
{
if(this.RefMov.State._currentframe == 3)
{
this.CanBeHit = false;
}
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.State = "ParryR";
}
}
function ParryR()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes or !this.RPress)
{
this.State = "EndParryR";
}
}
function EndParryR()
{
if(this.RefMov.State._currentframe == 3)
{
this.CanBeHit = true;
}
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartParryL()
{
if(this.RefMov.State._currentframe == 3)
{
this.CanBeHit = false;
}
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.State = "ParryL";
}
}
function ParryL()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes or !this.LPress)
{
this.State = "EndParryL";
}
}
function EndParryL()
{
if(this.RefMov.State._currentframe == 3)
{
this.CanBeHit = true;
}
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartPunchR()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.CheckHit();
this.State = "EndPunchR";
}
}
function EndPunchR()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartPunchL()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.CheckHit();
this.State = "EndPunchL";
}
}
function EndPunchL()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartKickR()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.CheckHit();
this.State = "EndKickR";
}
}
function EndKickR()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartKickL()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.CheckHit();
this.State = "EndKickL";
}
}
function EndKickL()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function StartSA()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
_global.C.Garry.State = "IsThrow";
this.PtSA = 0;
this.RefMov._parent.Interface.PlayerSA.gotoAndStop(1);
this.State = "EndSA";
}
}
function EndSA()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function GetHit()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.CanBeHit = true;
this.State = "EndGetHit";
}
}
function EndGetHit()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
this.ReturnIdle();
}
}
function Die()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes)
{
_global.Param.G_StartKO = true;
_global.Param.G_PtSA = 0;
this.State = "Dead";
_global.C.Enemy.WillWin = true;
}
}
function Win()
{
if(this.RefMov.State._currentframe >= this.RefMov.State._totalframes and _global.Param._parent.RoundTransit._currentframe == 1)
{
_global.Param.G_Score += _global.Param.G_WinPts;
_global.Param.G_ShowScore("Game.ShowScore.TxtScore");
_global.Param.G_PtSA = this.PtSA;
_global.Param.G_Winner = this.Nom;
_global.Param.G_KeepHealth += this.Health;
_global.Param.G_PlayerWin = _global.Param.G_PlayerWin + 1;
_global.Param._parent.RoundTransit.gotoAndPlay(2);
}
}
function CheckControl()
{
this.SetParryTime();
this.KeyMapping();
this.SetAction();
}
function KeyMapping()
{
if(Key.isDown(39))
{
if(this.RRelease)
{
this.RPress = true;
}
}
else
{
this.RRelease = true;
this.RPress = false;
}
if(Key.isDown(37))
{
if(this.LRelease)
{
this.LPress = true;
}
}
else
{
this.LRelease = true;
this.LPress = false;
}
if(Key.isDown(38))
{
this.DwPress = true;
}
else
{
this.DwPress = false;
}
if(Key.isDown(68))
{
if(this.DRelease)
{
this.DPress = true;
}
}
else
{
this.DRelease = true;
this.DPress = false;
}
if(Key.isDown(83))
{
if(this.SRelease)
{
this.SPress = true;
}
}
else
{
this.SRelease = true;
this.SPress = false;
}
if(Key.isDown(32))
{
if(this.SpRelease)
{
this.SpPress = true;
}
}
else
{
this.SpRelease = true;
this.SpPress = false;
}
}
function SetAction()
{
if(this.State == "Idle" and !_global.C.G_RoundOver)
{
this.ActionNow = "";
if(this.RPress and !this.LPress and this.RRelease)
{
this.RRelease = false;
this.ActionNow = "ParryR";
this.State = "StartParryR";
}
if(this.LPress and !this.RPress and this.LRelease)
{
this.LRelease = false;
this.ActionNow = "ParryL";
this.State = "StartParryL";
}
if(this.DPress and !this.SPress and this.DRelease)
{
this.DRelease = false;
if(_global.C.Garry.State != "IsThrow")
{
this.DoAttack = true;
if(this.DwPress)
{
this.ActionNow = "KickR";
this.State = "StartKickR";
}
else
{
this.ActionNow = "PunchR";
this.State = "StartPunchR";
}
}
}
if(this.SPress and !this.DPress and this.SRelease)
{
this.SRelease = false;
if(_global.C.Garry.State != "IsThrow")
{
this.DoAttack = true;
if(this.DwPress)
{
this.ActionNow = "KickL";
this.State = "StartKickL";
}
else
{
this.ActionNow = "PunchL";
this.State = "StartPunchL";
}
}
}
if(this.SpPress and this.SpRelease and this.PtSA == 100 and this.State != "StartSA" and this.State != "EndSA")
{
this.SpRelease = false;
this.ActionNow = "SA";
this.State = "StartSA";
}
}
}
function CheckHit()
{
if(_global.C.Enemy.CanBeHit)
{
_global.C.Enemy.SetGetHit(this[this.ActionNow + "Dammage"]);
this.WinPts();
}
else if(_global.C.Enemy.State == "Parry" or _global.C.Enemy.State == "StartParry")
{
_global.C.Enemy.State = "ParryBloc";
}
else if(_global.C.Enemy.State == "ParryR" or _global.C.Enemy.State == "StartParryR")
{
_global.C.Enemy.State = "ParryBlocR";
}
else if(_global.C.Enemy.State == "ParryL" or _global.C.Enemy.State == "StartParryL")
{
_global.C.Enemy.State = "ParryBlocL";
}
this.DoAttack = false;
}
function SetGetHit(l_Dammage)
{
this.DoAttack = false;
this.CanBeHit = false;
this.Health -= l_Dammage;
if(this.Health < 0)
{
this.Health = 0;
}
var _loc3_ = this.NbFace - int(this.Health * this.NbFace / this.MaxHealth);
this.RefMov._parent.Interface[this.Nom + "Face"].gotoAndStop(_loc3_);
if(this.Health > 0)
{
this.State = "GetHit";
}
else
{
_global.C.G_RoundOver = true;
this.State = "Die";
}
}
function WinPts(l_Pts)
{
if(l_Pts == undefined)
{
if((this.ActionNow == "PunchR" or this.ActionNow == "PunchL") and this.HaveParry and this.ParryTime > 0)
{
_global.Param.G_Score += this.ParryPunchPts;
this.HaveParry = false;
this.ParryTime = 0;
}
else
{
_global.Param.G_Score += this[this.ActionNow + "Pts"];
}
}
else
{
_global.Param.G_Score += l_Pts;
}
_global.Param.G_ShowScore("Game.ShowScore.TxtScore");
}
function SetParryTime()
{
if(this.ParryTime > 0)
{
this.ParryTime = this.ParryTime - 1;
if(this.ParryTime == 0)
{
this.HaveParry = false;
}
}
}
function ReturnIdle()
{
if(this.HaveParry and (this.State == "EndParryL" or this.State == "EndParryR"))
{
this.ParryTime = this.ParryTimeMax;
}
_global.C.Enemy.TryParry = false;
this.AvoidAttack = "";
this.CanBeHit = true;
this.State = "Idle";
}
}